<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="/includes.jsp"%>
<%@include file="/javascript/pickList.jsp"%>

<h1 class="layout">
    <logic:empty name="projectValue" property="projectId">
        Create
    </logic:empty>
    <logic:notEmpty name="projectValue" property="projectId">
        Edit
    </logic:notEmpty>
    Project
</h1>

<html:form action="project.do?method=edit" method="post">
    <table class="layout" style="background-image: url(<html:rewrite page='/icons/project-32x32.png'/>);">
        <tr>
            <th class="layout">Name:</th>
            <td class="layout"><html:text name="projectActionForm" property="name" size="80"/></td>
        </tr>
        <tr>
            <th class="layout">Description:</th>
            <td class="layout"><html:textarea name="projectActionForm" property="description" cols="60" rows="10"/></td>
        </tr>
        <tr>
            <th class="layout">Priority:</th>
            <td class="layout">
                <html:select name="projectActionForm" property="priority">
                    <html:options collection="priorityPairs" property="integer" labelProperty="string"/>
                </html:select>
            </td>
        </tr>
        <tr>
            <th class="layout">Sponsor:</th>
            <td class="layout">
                <html:select name="projectActionForm" property="sponsorId">
                    <html:options collection="personPairs" property="integer" labelProperty="string"/>
                </html:select>
            </td>
        </tr>
        <tr>
            <th class="layout">Primary Contact:</th>
            <td class="layout">
                <html:select name="projectActionForm" property="primaryContactId">
                    <html:options collection="personPairs" property="integer" labelProperty="string"/>
                </html:select>
            </td>
        </tr>
        <tr>
            <th class="layout">Owner:</th>
            <td class="layout">
                <html:select name="projectActionForm" property="ownerId">
                    <html:options collection="ownerPairs" property="integer" labelProperty="string"/>
                </html:select>
            </td>
        </tr>
        <tr>
            <th class="layout">Task Type</th>
            <td class="layout">
                <html:select name="projectActionForm" property="taskTypeId">
                    <html:options collection="taskTypePairs" property="integer" labelProperty="string"/>
                </html:select>
            </td>
        </tr>
        <tr>
            <th class="layout">% Complete:</th>
            <td class="layout">
                <html:select name="projectActionForm" property="percentageComplete">
                    <html:options collection="completePairs" property="integer" labelProperty="string"/>
                </html:select>
            </td>
        </tr>
        <tr>
            <th class="layout">Duration:</th>
            <td class="layout">
                <html:select name="projectActionForm" property="durationDays">
                    <html:options collection="days" property="integer" labelProperty="string"/>
                </html:select>day:<html:select name="projectActionForm" property="durationHours">
                    <html:options collection="hours" property="integer" labelProperty="string"/>
                </html:select>hr:<html:select name="projectActionForm" property="durationMins">
                    <html:options collection="minutes" property="integer" labelProperty="string"/>
                </html:select>min
            </td>
        </tr>
        <logic:empty name="projectValue" property="projectId">
            <tr>
                <th class="layout">Interested:</th>
                <td class="layout"><html:checkbox name="projectActionForm" property="isInterested"/></td>
            </tr>
        </logic:empty>
        <logic:notEmpty name="projectValue" property="projectId">
            <tr>
                <th class="layout">Interested:</th>
                <td class="layout">
                    <table>
                        <tr>
                            <td>
                                <html:select multiple="true" size="5" name="projectActionForm" property="allInterestedContactableIds" style="width:200">
                                    <html:options collection="allContactablePairs" property="integer" labelProperty="string"/>
                                </html:select>
                            </td>
                            <td align="center" valign="middle">
                                <input type="button" onclick="remove(this.form.allInterestedContactableIds,this.form.interestedContactableIds)" value="<<" id=button1 name=button1>
                                <input type="button" onclick="add(this.form.allInterestedContactableIds,this.form.interestedContactableIds)" value=">>" id=button2 name=button2>
                            </td>
                            <td>
                                <html:select multiple="true" size="5" name="projectActionForm" property="interestedContactableIds" style="width:200">
                                    <html:options collection="interestedContactablePairs" property="integer" labelProperty="string"/>
                                </html:select>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <th class="layout">Responsible:</th>
                <td class="layout">
                    <table>
                        <tr>
                            <td>
                                <html:select multiple="true" size="5" name="projectActionForm" property="allResponsibleContactableIds" style="width:200">
                                    <html:options collection="allContactablePairs" property="integer" labelProperty="string"/>
                                </html:select>
                            </td>
                            <td align="center" valign="middle">
                                <input type="button" onclick="remove(this.form.allResponsibleContactableIds,this.form.responsibleContactableIds)" value="<<" id=button3 name=button3>
                                <input type="button" onclick="add(this.form.allResponsibleContactableIds,this.form.responsibleContactableIds)" value=">>" id=button4 name=button4>
                            </td>
                            <td>
                                <html:select multiple="true" size="5" name="projectActionForm" property="responsibleContactableIds" style="width:200">
                                    <html:options collection="responsibleContactablePairs" property="integer" labelProperty="string"/>
                                </html:select>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </logic:notEmpty>
    </table>
    <div class="buttons">
        <html:submit property="btnSubmit" value="OK" onclick="selectAll(document.projectValueActionForm.interestedContactableIds);selectAll(document.projectValueActionForm.responsibleContactableIds);"/>
        <html:cancel property="btnSubmit" value="Cancel"/>
    </div>
</html:form>
